#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <unordered_set>
using namespace std;

// 文法产生式定义
extern map<string, vector<vector<string>>> productions;

extern map<string, unordered_set<string>> first;
extern map<string, unordered_set<string>> follow;

bool isTerminal(const string& symbol);
void computeAllFirst();
void computeAllFollow();
void printSet(const map<string, unordered_set<string>>& sets);